<!--
Copyright (c) 2021-2024 SigScalr, Inc.

This file is part of SigLens Observability Solution

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<!DOCTYPE html>
<html lang="en">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5SBJC04YFB"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());

    gtag('config', 'G-5SBJC04YFB');
</script>

<head>
    <meta charset="UTF-8">
    <title>SigLens</title>

    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="apple-touch-icon" sizes="180x180" href="./assets/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="./assets/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="./assets/favicon-16x16.png">
    <link rel="manifest" href="./assets/site.webmanifest">
    <link rel="mask-icon" href="./assets/safari-pinned-tab.svg" color="#5bbad5">
    <meta name="msapplication-TileColor" content="#da532c">

    <link rel="stylesheet" href="./css/lib/bootstrap.min.css" />
    <link rel="stylesheet" href="./css/lib/all.min.css" />
    <link rel="stylesheet" href="./css/lib/ag-grid.min.css" />
    <link rel="stylesheet" href="./css/siglens.css?cb={{ AppVersion }}" />

    <script src="./js/lib/lodash.min.js"></script>
    <script src="./js/lib/jquery-3.6.0.min.js"></script>
    <script src="./js/lib/jquery-ui.min.js"></script>
    <script src="./js/lib/js.cookie.min.js"></script>
    <script src="./js/lib/moment.min.js"></script>
    <script src="./js/lib/date_fns.min.js"></script>
    <script src="./js/lib/popper.min.js"></script>
    <script src="./js/lib/bootstrap.bundle.min.js"></script>
    <script src="./js/lib/ag-grid-community.min.noStyle.js"></script>
    <script>
        var defaultTheme = Cookies.get('theme') || 'light';
        $('html').attr('data-theme', defaultTheme);
    </script>
    {{ .RunCheck1 | safeHTML }}
</head>
{{ if not .EnterpriseEnabled }}
<body>
    <div id="app-container">
        <div id="app-side-nav">
        </div>

        <div class="myOrg">
            <div class="myOrg-container">
                <div class="org-nav-tab">
                </div>

                <div class="myOrg-inner-container">
                    <div class="org-settings">
                        <div id="api-keys-headings">
                            <p class="caption">Personalize your PQS settings</p>
                        </div>
                        <table class="org-settings-table" id="pqs-settings-table">
                            <tr>
                                <th>Persistent Queries</th>
                                <td>
                                    <div class="dropdown">
                                        <button class="btn dropdown-toggle px-4" type="button" id="contact-types"
                                            data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                                            data-bs-toggle="dropdown">
                                            <span
                                                style="color: var(--health-stats-value-text-color); margin-left: -10px;">Enabled</span>
                                            <i class="dropdown-arrow"></i>
                                        </button>
                                        <div class="dropdown-menu box-shadow contact-options">
                                            <li id="option-0" class="contact-option active">Enabled</li>
                                            <li id="option-1" class="contact-option">Disabled</li>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                        <div class="mt-3">
                            <button type="button" class="btn btn-primary" id="clear-pqs-info">Clear PQS Meta Data</button>
                        </div>
                    </div>
                    <div class="pqs-tables">
                        <h3 class="mt-5">Promoted Searches</h3>
                        <div id="ag-grid-promoted-searches" class="ag-theme-mycustomtheme mt-3 pqs-grid" style="height: 329px;"></div>
                        <h3 class="mt-5">Promoted Aggregations</h3>
                        <div id="ag-grid-promoted-aggregations" class="ag-theme-mycustomtheme mt-3 pqs-grid mb-4" style="height: 329px;"></div>
                    </div>
                </div>
                <div class="popupOverlay">
                </div>
                <div class="popupContent" id="disable-pqs-prompt">
                    <div class="disable-dialog">
                        <h3 class="header">Disable Persistent Queries</h3>
                        <p>
                            Disabling persistent queries may affect your query performance.
                        </p>
                        <div class="mt-4 d-flex align-items-center justify-content-end gap-3">
                            <button type="button" class="btn-secondary btn" id="cancel-disable-pqs">Cancel</button>
                            <button type="button" id="disable-pqs" class="btn-primary btn">OK</button>
                        </div>
                    </div>
                </div>
                <div class="popupContent" id="clear-pqs-prompt">
                    <div class="disable-dialog">
                        <h3 class="header">Confirmation</h3>
                        <p>Are you sure you want to clear PQS Info?
                        </p>
                        <div class="mt-4 d-flex align-items-center justify-content-end">
                            <button type="button" class="saveqButton btn-primary btn" id="cancel-pqs"
                                style="margin-left: 0px !important;">Cancel</button>
                            <button type="button" id="clear-pqs" class="cancelqButton btn-secondary btn"
                                style="margin-left: 14px !important;">Clear</button>
                        </div>
                    </div>
                </div>
                <div class="popupContent" id="pqs-id-details">
                    <div class="disable-dialog">
                        <div class="d-flex justify-content-between align-items-center">
                            <div>
                                <h3 class="header">Details</h3>
                            </div>
                            <div class="close-btn"></div>
                        </div>
                        <textarea class="json-body"></textarea>
                        <div class="mt-2 d-flex justify-content-end">
                            <button type="button" id="close-popup" class="saveqButton btn-secondary btn">OK</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="app-footer">
    </div>
    </div>
    <script src="./js/navbar.js?cb={{ AppVersion }}"></script>
    <script src="./js/common.js?cb={{ AppVersion }}"></script>
    <script src="./js/event-handlers.js?cb={{ AppVersion }}"></script>
    <script src="./component/upper-navbar/upper-navbar.js?cb={{ AppVersion }}"></script>
    <script src="./js/pqs-settings.js?cb={{ AppVersion }}"></script>
    <script src="./js/footer.js?cb={{ AppVersion }}"></script>


    {{ .RunCheck2 | safeHTML }}
    {{ .RunCheck3 | safeHTML }}
</body>
{{ end }}

</html>